package xx.iverson.school_manage.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import xx.iverson.school_manage.entity.Classes;
import xx.iverson.school_manage.service.ClassesService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wei77
 */
@Controller
public class ClassesController {
    @Resource
    private ClassesService classesService;

    // 查询所有年级
    @RequestMapping("selectClasses")
    @ResponseBody
    public List<Classes> selectClasses() {
        return classesService.getClasses();
    }

    // 删除年级
    @RequestMapping("deleteClasses")
    @ResponseBody
    public Boolean deleteClasses(Integer id) {
        return classesService.deleteClasses(id);
    }

    // 添加年级
    @RequestMapping("insertClasses")
    @ResponseBody
    public Boolean insertClasses(Integer classId,String classesName) {
        return classesService.insertClasses(classId,classesName);
    }
}
